<template>
  <div>
    <table>
      <tr>
        <td>账号</td>
        <td><input type="text" v-model="state.name" /></td>
      </tr>
      <tr>
        <td>密码</td>
        <td><input type="password" v-model="state.pwd" /></td>
      </tr>
      <tr>
        <td></td>
        <td><input type="button" value="注册" @click="add" /></td>
      </tr>
    </table>
  </div>
</template>

<script setup lang="ts">
import {reactive,onmounted,toRefs} from 'vue'
import{useRouter,useRoute} from 'vue-router'
import axios from 'axios'
const router=useRouter()
const route=useRoute()
const data=reactive({
  state:{
      name:'',
      pwd:''
  }
})
const {state}=toRefs(data)
const add=()=>{
  axios({
    url:'https://localhost:7160/api/Member/Memberadd',
    method:'post',
    data:state.value
  })
  .then((res)=>{
    if(res.data.data>0){
      alert('注册成功');
    }
    else{
      alert('注册失败');
    }
  })
}
</script>

<style scoped>

</style>